package com.sizu.web;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sizu.common.statisticaldto.TPurchaseStatementDto;
import com.sizu.common.vo.ResultEntity;
import com.sizu.entity.TCustomerStatement;
import com.sizu.entity.TCustomerStatementZyx;
import com.sizu.entity.TPurchaseStatementZyx;
import com.sizu.service.ITPurchaseStatementService;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 赵玉玺
 * @since 2020-02-29
 */
@RestController
@RequestMapping("/statistical/tPurchaseStatement")
public class TPurchaseStatementController {

    @Resource
    private ITPurchaseStatementService itPurchaseStatementService;

    /**
     * 查询采购统计列表
     * @param tPurchaseStatementDto
     * @return
     */
    @RequestMapping("/list")
    public ResultEntity tPurchaseStatementList(TPurchaseStatementDto tPurchaseStatementDto){
        PageHelper.startPage(tPurchaseStatementDto.getPageNum(),tPurchaseStatementDto.getPageSize());
        TPurchaseStatementZyx tPurchaseStatementZyx=new TPurchaseStatementZyx();
        BeanUtils.copyProperties(tPurchaseStatementDto,tPurchaseStatementZyx);
        List<TPurchaseStatementZyx> purchaseStatementList = itPurchaseStatementService.getPurchaseStatementList(tPurchaseStatementZyx);
        PageInfo<TPurchaseStatementZyx> pageInfo=new PageInfo<>(purchaseStatementList);
        return ResultEntity.ok("查询成功",pageInfo);
    }

}
